import pytest
import os
import shutil


"""解决allure报告缓存和Jenkins无文件报错"""
def clear_allure():
    filepath = (os.path.abspath(os.path.dirname(__file__)) + "/allure-results/")
    if os.path.exists(filepath):
        shutil.rmtree("{}".format(filepath))
        os.makedirs("{}".format(filepath))
    else:
        os.makedirs("{}".format(filepath))
    path_report = (os.path.abspath(os.path.dirname(__file__)) + "/allure-report")
    if os.path.exists(path_report):
        shutil.rmtree("{}".format(path_report))